package com.hnucm.eatwhat_java.util;

import android.app.Application;
import android.graphics.Bitmap;
import android.util.Log;


import androidx.annotation.NonNull;
import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.Observer;

import com.hnucm.eatwhat_java.R;
import com.hnucm.eatwhat_java.dao.ShopDao;
import com.hnucm.eatwhat_java.dao.ShopDaoDataBase;
import com.hnucm.eatwhat_java.pojo.Shop;
import com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiskCache;
import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator;
import com.nostra13.universalimageloader.cache.memory.impl.UsingFreqLimitedMemoryCache;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;
import com.nostra13.universalimageloader.core.assist.QueueProcessingType;
import com.nostra13.universalimageloader.core.download.BaseImageDownloader;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

public class UtilApplication extends Application {

    private final static String TAG="UtilApplication";

    private static List<Shop> shopList=new ArrayList<>();
    private static ShopDao shopDao;

    public UtilApplication() {
    }

    public static List<Shop> getShopList() {
        return shopList;
    }

    public static ShopDao getShopDao() {
        return shopDao;
    }

    @Override
    public void onCreate() {
        Log.e(TAG, "onCreate: ");
        shopDao=ShopDaoDataBase.getInstance(this).getShopDao();
        if(shopDao.getAllShop().size()==0){
            shopDao.insertShop(new Shop("麻辣烫",""));
            shopDao.insertShop(new Shop("一荤一素",""));
            shopDao.insertShop(new Shop("重庆小面",""));
            shopDao.insertShop(new Shop("炒饭",""));
        }
        shopList=shopDao.getAllShop();
        super.onCreate();

    }
}
